﻿//        Another Demo from Andy L. & MissedMemo.com
// Borrow whatever code seems useful - just don't try to hold
// me responsible for any ill effects. My demos sometimes use
// licensed images which CANNOT legally be copied and reused.

using System.Windows.Controls;
using System.ComponentModel;
using System.Windows.Data;

using MissedMemo.MeatAndCheeseDisc.OrderEntryDataAccess;


namespace MissedMemo.MeatAndCheeseDisc.OrderEntry
{
    public partial class viewAddEditDrink : UserControl
    {
        public viewAddEditDrink()
        {
            InitializeComponent();

            if( false == DesignerProperties.GetIsInDesignMode( this ) )
            {
                foreach( string strType in LookupMenuItem.GetTypes( "Drink" ) )
                    comboDrinkType.Items.Add( strType );
            }
        }

        
        // Update sizes, based on type (There's no 'Pint' of Pepsi...)

        private void comboDrinkTypes_SelectionChanged( object sender, SelectionChangedEventArgs e )
        {
            string strType = comboDrinkType.SelectedValue as string;

            if( strType != null )
            {
                comboDrinkSize.Items.Clear();

                foreach( string strSize in LookupMenuItem.GetSizes( "Drink", strType ) )
                    comboDrinkSize.Items.Add( strSize );

                comboDrinkSize.SelectedIndex = 0;
            }
        }
    }
}
